Added unit test for points almost on a line, that previously resulted in NAN values.#6426
Open
larshg wants to merge 1 commit intoPointCloudLibrary:masterfrom
Open
Added unit test for points almost on a line, that previously resulted in NAN values.#6426larshg wants to merge 1 commit intoPointCloudLibrary:masterfrom
larshg wants to merge 1 commit intoPointCloudLibrary:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a regression unit test to ensure MovingLeastSquares with SAMPLE_LOCAL_PLANE upsampling does not emit NaN coordinates for an (almost) collinear input set, addressing the scenario described in #787 (adapted from #788).
Changes:
- Introduces a new
TEST(PCL, MovingLeastSquares_almost_on_line)case with a small, nearly collinearPointXYZinput. - Runs MLS with
SAMPLE_LOCAL_PLANEupsampling and asserts output points are finite.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+64
to
+71
| PointCloud<PointXYZ>::Ptr cloud_almost_on_line(new PointCloud<PointXYZ>); | ||
|
|
||
| TEST(PCL, MovingLeastSquares_almost_on_line) | ||
| { | ||
| cloud_almost_on_line->push_back(pcl::PointXYZ(-89.546, 4.03964, 450.883)); | ||
| cloud_almost_on_line->push_back(pcl::PointXYZ(-88.8728, 4.03964, 450.883)); | ||
| cloud_almost_on_line->push_back(pcl::PointXYZ(-86.8529, 4.03964, 450.883)); | ||
| cloud_almost_on_line->push_back(pcl::PointXYZ(-85.5064, 4.03964, 450.883)); |
Comment on lines
+84
to
+90
| // Reconstruct | ||
| mls.process(mls_points); | ||
|
|
||
| for (size_t i = 0; i < mls_points.size(); ++i) { | ||
| // Check for NaNs in output | ||
| EXPECT_TRUE(pcl::isFinite(mls_points[i])); | ||
| } |
| search::KdTree<PointXYZ>::Ptr tree3; | ||
| search::KdTree<PointNormal>::Ptr tree4; | ||
|
|
||
| PointCloud<PointXYZ>::Ptr cloud_almost_on_line(new PointCloud<PointXYZ>); |
mvieth
reviewed
Apr 17, 2026
Comment on lines
+87
to
+89
| for (size_t i = 0; i < mls_points.size(); ++i) { | ||
| // Check for NaNs in output | ||
| EXPECT_TRUE(pcl::isFinite(mls_points[i])); |
Member
There was a problem hiding this comment.
Suggested change
| for (size_t i = 0; i < mls_points.size(); ++i) { | |
| // Check for NaNs in output | |
| EXPECT_TRUE(pcl::isFinite(mls_points[i])); | |
| for (const auto& mls_point : mls_points) { | |
| // Check for NaNs in output | |
| EXPECT_TRUE(pcl::isFinite(mls_point)); |
Suggested by clang-tidy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adapted unit test from #788
Closes #787 as it verifies that it is already fixed.